package com.eascs.web.o2o.quartz.service;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.scheduler.common.entity.ScheduleJob;
import com.eascs.web.o2o.quartz.dao.BaseJobDao;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import java.util.List;

@Service
public class BaseJobService {

	protected final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Inject
	BaseJobDao baseDao;
	
	public boolean updateEntity(ScheduleJob job){
		return baseDao.updateEntity(job);
	}

	public List<ScheduleJob> getJobList(){
		return baseDao.findEntitys("select * from schedule_job", ScheduleJob.class);
	}
	
	public ScheduleJob getJobByName(String annotionName,String methodName){
		return (ScheduleJob) baseDao.findEntity("select * from schedule_job where class_path =? and method=?", ScheduleJob.class, annotionName,methodName);
	}
}
